import Vue from "vue";
import axios from "axios";

console.log("put urls into main prototype");
Vue.prototype.$innerUrl = {
  liveServer: "http://10.8.51.45:8000",
  dataServer: "http://10.8.51.45:3050/api",
  fileServer: "http://10.8.51.45:5000",
  socketServer: "http://10.8.51.45:3050",
};

Vue.prototype.$hebtuServer = {
  liveServer: "http://192.168.8.104:8000",
  dataServer: "http://192.168.8.104:3050/api",
  fileServer: "http://192.168.8.104:9998",
  socketServer: "http://192.168.8.104:3050",
};

Vue.prototype.$localNoDocker = {
  liveServer: "http://10.8.51.45:8000",
  dataServer: "http://localhost:5000",
  fileServer: "http://localhost:9998",
  socketServer: "http://localhost:5000",
};
// 选择模式
Vue.prototype.$URLS = Vue.prototype.$innerUrl
const serverURL = Vue.prototype.$URLS.dataServer;
const token = localStorage.getItem("tk");

export default axios.create({
  baseURL: serverURL,
  headers: { Authorization: "Bearer " + token },
  timeout: 10000,
});
